package com.spsoft.dmzeinvoice.controller;

import com.spsoft.core.annotation.AnonymousAccess;
import com.spsoft.core.model.Result;
import com.spsoft.dmzeinvoice.service.sandbox.SandboxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;

import org.springframework.web.bind.annotation.*;



@Api(tags = {"沙箱环境控制接口"})
@RequestMapping("/sandbox")
@RestController
@RequiredArgsConstructor
public class SandboxController {

    final SandboxService sandboxService;


    @ApiOperation("虚拟单位企业数据查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nsrsbh", value = "纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssjswjgDm", value = "省市级税务机关代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/CXXNQYXX", method = RequestMethod.POST, permissionCode = "")
    public Result<String> cxxnqyxx(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                            @RequestParam(value = "sydwptbh") String sydwptbh,
                                            @RequestParam(value = "access_signature") String access_signature,
                                            @RequestParam(value = "nsrsbh") String nsrsbh,
                                            @RequestParam(value = "ssjswjgDm") String ssjswjgDm
                                            ) {
       return sandboxService.cxxnqyxx(jrdwptbh, sydwptbh, access_signature, nsrsbh, ssjswjgDm);
    }

    @ApiOperation("企业基础信息更新")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query")

    })
    @AnonymousAccess(value = "/GXQYXX", method = RequestMethod.POST, permissionCode = "")
    public Result<String> gxqyxx(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                  @RequestBody String body) {
        return sandboxService.gxqyxx(jrdwptbh, sydwptbh, access_signature, body);
    }
    @ApiOperation("企业信息重置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nsrsbh", value = "纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssjswjgDm", value = "省市级税务机关代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/CZQYXX", method = RequestMethod.POST, permissionCode = "")
    public Result<String> czqyxx(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                   @RequestParam(value = "nsrsbh") String nsrsbh,
                                   @RequestParam(value = "ssjswjgDm") String ssjswjgDm
    ) {
        return sandboxService.czqyxx(jrdwptbh, sydwptbh, access_signature, nsrsbh, ssjswjgDm);
    }
    @ApiOperation("发票入账抵扣状态变更")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = Long.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "xsfnsrsbh", value = "销售方纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "gmfnsrsbh", value = "购买方纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "fphm", value = "蓝字发票发票号码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "fprzztDm", value = "发票入账状态代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "fpdkztDm", value = "发票抵扣状态代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/FPRZDKZTBG", method = RequestMethod.POST, permissionCode = "")
    public Result<String> fprzdkztbg(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                     @RequestParam(value = "xsfnsrsbh")  String xsfnsrsbh,
                                     @RequestParam(value = "gmfnsrsbh") String gmfnsrsbh,
                                     @RequestParam(value = "fphm") String fphm,
                                     @RequestParam(value = "fprzztDm") String fprzztDm,
                                     @RequestParam(value = "fpdkztDm") String fpdkztDm
    ) {
        return sandboxService.fprzdkztbg(jrdwptbh, sydwptbh, access_signature, xsfnsrsbh, gmfnsrsbh, fphm, fprzztDm, fpdkztDm);
    }
    @ApiOperation("增加纳税人授信额度")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nsrsbh", value = "纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssjswjgDm", value = "省市级税务机关代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssq", value = "属期", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "ed", value = "额度", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/ZJNSRSXED", method = RequestMethod.POST, permissionCode = "")
    public Result<String> zjnsrsxed(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                   @RequestParam(value = "nsrsbh") String nsrsbh,
                                   @RequestParam(value = "ssjswjgDm") String ssjswjgDm,
                                   @RequestParam(value = "ssq") String ssq,
                                   @RequestParam(value = "ed") String ed
    ) {
        return sandboxService.zjnsrsxed(jrdwptbh, sydwptbh, access_signature, nsrsbh, ssjswjgDm,  ssq,  ed);
    }
    @ApiOperation("税控蓝票初始化")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nsrsbh", value = "纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssjswjgDm", value = "省市级税务机关代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "lzfppzDm", value = "蓝字发票票种代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sfzzfpbz", value = "是否纸质发票标志", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/SKLPCSH", method = RequestMethod.POST, permissionCode = "")
    public Result<String> sklpcsh(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                   @RequestParam(value = "nsrsbh") String nsrsbh,
                                   @RequestParam(value = "ssjswjgDm") String ssjswjgDm,
                                   @RequestParam(value = "lzfppzDm") String lzfppzDm,
                                   @RequestParam(value = "sfzzfpbz") String sfzzfpbz
    ) {
        return sandboxService.sklpcsh(jrdwptbh, sydwptbh, access_signature, nsrsbh,  ssjswjgDm,  lzfppzDm,  sfzzfpbz);
    }

    @ApiOperation("企业信息初始化")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jrdwptbh", value = "直连单位平台ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "sydwptbh", value = "使用单位乐企ID", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "access_signature", value = "签名加密串(暂不填写)", dataTypeClass = String.class, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nsrsbh", value = "纳税人识别号", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "ssjswjgDm", value = "省市级税务机关代码", dataTypeClass = String.class, dataType = "String", paramType = "query", required = true)
    })
    @AnonymousAccess(value = "/QYXXCSH", method = RequestMethod.POST, permissionCode = "")
    public Result<String> qyxxcsh(@RequestParam(value = "jrdwptbh") String jrdwptbh,
                                   @RequestParam(value = "sydwptbh") String sydwptbh,
                                   @RequestParam(value = "access_signature") String access_signature,
                                   @RequestParam(value = "nsrsbh") String nsrsbh,
                                   @RequestParam(value = "ssjswjgDm") String ssjswjgDm
    ) {
        return sandboxService.qyxxcsh(jrdwptbh, sydwptbh, access_signature, nsrsbh, ssjswjgDm);
    }
}
